<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<style type="text/css">
    li.aa {
        padding-top: 5px;
    }
    iframe#iframe9 {
        height: 120px;
    }
    iframe#iframe8 {
        height: 220px;
    }
    iframe#iframe6 {
        height: 340px;
    }
    iframe#iframe5,iframe#iframe4,iframe#iframe3 {
        height: 370px;
    }
    iframe#iframe2 {
        height: 361px;
    }
    iframe#iframe7 {
         height: 871px;
    }
    iframe#iframe0 {
        height: 460px;
    }

</style>
<body class="gray-bg">

<div class="container-div">
    <div class="row">
        <div class="col-sm-12"
             style="width:100%;background:#fff;padding-top:13px;padding-bottom:13px;box-shadow:1px 1px 3px rgba(0,0,0,.2);z-index: 9999; position: fixed ! important; right: 0px; top: 0px;">
            <h3 id="jsuan">

            </h3>
            <form id="formId">
                <div class="select-list">

                    <ul>
                        <li>
                            用户名称：<input type="text" th:value="${basics.user.name}" readonly="true">
                        </li>
                        <li>
                            表计：
                            <select id="pointId" name="pointId" onchange="reLoad()">
                                <option th:each="user : ${points}" th:text="${user.name}"
                                        th:value="${user.id}"></option>
                            </select>
                        </li>
                        <li>
                            户号：<input id="userNum" name="userNum" type="text" th:value="${points[0].userNum}"
                                      readonly="true">
                        </li>
                        <li>
                            电费类型：<input  type="text" th:value="${user.userType}"
                                      readonly="true">
                        </li>

                    </ul>
                </div>
            </form>
        </div>
        <div class="panel-group col-sm-12 select-table table-striped"
             style="position: absolute; right: 0px; top: 100px;">

            <div class="panel panel-default sugt">
                <div class="panel-heading">
                    <h4 class="panel-title">
                        <a data-toggle="collapse" href="#collapseOne">
                            基本电价及直接交易信息
                        </a>
                    </h4>
                </div>
                <div id="collapseOne" class="panel-collapse collapse">
                    <div class="panel-body">
                        <iframe id="iframe0" class="RuoYi_iframe" name="iframe0" width="100%" height="100%"
                                data-id="/system/main"
                                frameborder="0" seamless></iframe>
                    </div>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title">
                        <a data-toggle="collapse" href="#collapseTwo">
                            富余电量信息
                        </a>
                    </h4>
                </div>
                <div id="collapseTwo" class="panel-collapse collapse">
                    <div class="panel-body">
                        <iframe id="iframe2" class="RuoYi_iframe" name="iframe2" width="100%" height="100%"
                                data-id="/system/main"
                                frameborder="0" seamless></iframe>
                    </div>
                </div>
            </div>

            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title">
                        <a data-toggle="collapse" href="#collapseThree">
                            丰水期低谷时段弃水电量
                        </a>
                    </h4>
                </div>
                <div id="collapseThree" class="panel-collapse collapse">
                    <div class="panel-body">
                        <iframe id="iframe3" class="RuoYi_iframe" name="iframe3" width="100%" height="100%"
                                data-id="/system/main"
                                frameborder="0" seamless></iframe>
                    </div>
                </div>
            </div>

            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title">
                        <a data-toggle="collapse" href="#collapseFour">
                            留存电量
                        </a>
                    </h4>
                </div>
                <div id="collapseFour" class="panel-collapse collapse">
                    <div class="panel-body">
                        <iframe id="iframe4" class="RuoYi_iframe" name="iframe4" width="100%" height="100%"
                                data-id="/system/main"
                                frameborder="0" seamless></iframe>
                    </div>
                </div>
            </div>

            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title">
                        <a data-toggle="collapse" href="#collapseFive">
                            执行目录电价（市场电量以外的电量）
                        </a>
                    </h4>
                </div>
                <div id="collapseFive" class="panel-collapse collapse">
                    <div class="panel-body">
                        <iframe id="iframe5" class="RuoYi_iframe" name="iframe5" width="100%" height="100%"
                                data-id="/system/main"
                                frameborder="0" seamless></iframe>
                    </div>
                </div>
            </div>

            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title">
                        <a data-toggle="collapse" href="#collapseSix">
                            节能替代方案
                        </a>
                    </h4>
                </div>
                <div id="collapseSix" class="panel-collapse collapse">
                    <div class="panel-body">
                        <iframe id="iframe6" class="RuoYi_iframe" name="iframe6" width="100%" height="100%"
                                data-id="/system/main"
                                frameborder="0" seamless></iframe>
                    </div>
                </div>
            </div>

            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title">
                        <a data-toggle="collapse" href="#collapseSeven">
                            假设执行政府定价
                        </a>
                    </h4>
                </div>
                <div id="collapseSeven" class="panel-collapse collapse">
                    <div class="panel-body">
                        <iframe id="iframe7" class="RuoYi_iframe" name="iframe7" width="100%" height="100%"
                                data-id="/system/main"
                                frameborder="0" seamless></iframe>
                    </div>
                </div>
            </div>

            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title">
                        <a data-toggle="collapse" href="#collapseEight">
                            实际执行情况合计
                        </a>
                    </h4>
                </div>
                <div id="collapseEight" class="panel-collapse collapse">
                    <div class="panel-body">
                        <iframe id="iframe8" class="RuoYi_iframe" name="iframe8" width="100%" height="100%"
                                data-id="/system/main"
                                frameborder="0" seamless></iframe>
                    </div>
                </div>
            </div>

            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title">
                        <a data-toggle="collapse" href="#collapseNine">
                            优惠电费
                        </a>
                    </h4>
                </div>
                <div id="collapseNine" class="panel-collapse collapse">
                    <div class="panel-body">
                        <iframe id="iframe9" class="RuoYi_iframe" name="iframe9" width="100%" height="100%"
                                data-id="/system/main"
                                frameborder="0" seamless></iframe>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>

<script th:inline="javascript">
    $(function () {
        var trade = [[${trade}]];
        var surplus = [[${surplus}]];
        var abundantWater = [[${abundantWater}]];
        var keep = [[${keep}]];
        var execute = [[${execute}]];
        var economize = [[${economize}]];
        var assume = [[${assume}]];
        var reality = [[${reality}]];
        var discount = [[${discount}]];
        $("#iframe0").attr("src", ctx + "service/trade/edit/" + trade);
        $("#iframe2").attr("src", ctx + "service/surplus/edit/" + surplus);
        $("#iframe3").attr("src", ctx + "service/abundantWater/edit/" + abundantWater);
        $("#iframe4").attr("src", ctx + "service/keep/edit/" + keep);
        $("#iframe5").attr("src", ctx + "service/execute/edit/" + execute);
        $("#iframe6").attr("src", ctx + "service/economize/edit/" + economize);
        $("#iframe7").attr("src", ctx + "service/assume/edit/" + assume);
        $("#iframe8").attr("src", ctx + "service/reality/edit/" + reality);
        $("#iframe9").attr("src", ctx + "service/discount/edit/" + discount);

        onself_adaption();

        var cc = null;
        var resultDate = [[${basics.resultDate}]];
        if(resultDate == null){
            cc = "";
        }else{
            cc = new Date(resultDate).Format('yyyy-MM');
        }
        var num = [[${basics.name}]];
        document.getElementById("jsuan").innerText = cc+"月"+num+"次结算";

    });
    function reLoad() {
        var points = [[${points}]];
        var pointId = $("#pointId").val();
        for (p in points) {
            if (points[p].id == pointId) {
                $("#userNum").val(points[p].userNum);
            }
        }
        var basicsId = [[${basics.id}]];
        var map = {
            pointId: pointId,
            basicsId: basicsId
        }
        console.log(map);
        var config = {
            url: ctx + "service/basics/getPointInfo",
            type: "post",
            dataType: "json",
            data: map,
            success: function (result) {
                console.log(result);
                console.log(result.trade);
                $("#iframe0").attr("src", ctx + "service/trade/edit/" + result.trade);
                $("#iframe2").attr("src", ctx + "service/surplus/edit/" + result.surplus);
                $("#iframe3").attr("src", ctx + "service/abundantWater/edit/" + result.abundantWater);
                $("#iframe4").attr("src", ctx + "service/keep/edit/" + result.keep);
                $("#iframe5").attr("src", ctx + "service/execute/edit/" + result.execute);
                $("#iframe6").attr("src", ctx + "service/economize/edit/" + result.economize);
                $("#iframe7").attr("src", ctx + "service/assume/edit/" + result.assume);
                $("#iframe8").attr("src", ctx + "service/reality/edit/" + result.reality);
                $("#iframe9").attr("src", ctx + "service/discount/edit/" + result.discount);
            },
        };
        $.ajax(config)
    };

    function onself_adaption() {
        var fram = document.getElementById("iframe0");
        var fram2 = document.getElementById("iframe2");
        var fram3 = document.getElementById("iframe3");
        var fram4 = document.getElementById("iframe4");
        var fram5 = document.getElementById("iframe5");
        var fram6 = document.getElementById("iframe6");
        var fram7 = document.getElementById("iframe7");
        var fram8 = document.getElementById("iframe8");
        var fram9 = document.getElementById("iframe9");

        fram.height = document.documentElement.clientHeight;
        fram2.height = document.documentElement.clientHeight;
        fram3.height = document.documentElement.clientHeight;
        fram4.height = document.documentElement.clientHeight;
        fram5.height = document.documentElement.clientHeight;
        fram6.height = document.documentElement.clientHeight;
        fram7.height = document.documentElement.clientHeight;
        fram8.height = document.documentElement.clientHeight;
        fram9.height = document.documentElement.clientHeight;
    }


    Date.prototype.Format = function (fmt) {
        var o = {
            "M+": this.getMonth() + 1, //月份
            "d+": this.getDate(), //日
            "h+": this.getHours(), //小时
            "m+": this.getMinutes(), //分
            "s+": this.getSeconds(), //秒
            "q+": Math.floor((this.getMonth() + 3) / 3), //季度
            "S": this.getMilliseconds() //毫秒
        };
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    }

</script>
</body>
</html>